home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource for Source: C/C++
/
Resource for Source - C-C++.iso
/
codelib9
/
v_11_01
/
1101036a
< prev
next >
Wrap
Text File
|
1995-11-01
|
1KB
|
47 lines
/* LISTING 1: A C++ class to encapsulate the MS Windows
WNDCLASS.
*/
#include "windows.h"
typedef int BOOL;
typedef WNDPROC MYWNDPROC;
typedef HINSTANCE MYHINSTANCE;
typedef HCURSOR MYHCURSOR;
typedef HBRUSH MYHBRUSH;
class MyWndClass
{
public:
MyWndClass (char *, MYWNDPROC, MYHINSTANCE, char *);
void SetCursor (MYHCURSOR hCursor)
{ wndclass.hCursor = hCursor; }
void SetBackground (MYHBRUSH hbrBackground)
{ wndclass.hbrBackground = hbrBackground; }
void SetMenu (char *szMenuName)
{ wndclass.lpszMenuName = szMenuName; }
BOOL RegisterClass (void)
{ return (::RegisterClass (&wndclass)); }
private:
// Default constructor is inaccessible.
MyWndClass (void);
WNDCLASS wndclass;
};
MyWndClass::MyWndClass (char *szAppName, MYWNDPROC
WndProc, MYHINSTANCE hInstance, char *szMenuName)
{
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
wndclass.hbrBackground =
GetStockObject (WHITE_BRUSH);
wndclass.lpszMenuName = szMenuName;
wndclass.lpszClassName = szAppName;
}